home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / Media / bumpshader3.vsh < prev    next >
Text File  |  2001-10-08  |  690b  |  49 lines

  1. vs.1.0
  2.  
  3. ;Constants 
  4. ;
  5. ;c0-c3 Object
  6. ;
  7. ;c4-c7 Projection
  8. ;
  9. ;c8-c11 Total matrix
  10. ;
  11. ;c12 - Light Direction (In World Space)
  12. ;
  13. ;Input
  14. ;
  15. ;V0 - Position
  16. ;V7 - Texture 
  17. ;V3 - Normal
  18. ;V8 - Tangnet
  19.  
  20.  
  21. ;Take normal and binormal into worldspace first
  22. m3x3 r7,v8,c0
  23. m3x3 r8,v3,c0
  24.  
  25. ;Cross product, flip orienation 
  26. ;may or may not be neccisary here 
  27. ;depending on the content
  28. mul r0,r7.zxyw,-r8.yzxw;
  29. mad r5,r7.yzxw,-r8.zxyw,-r0;
  30.  
  31. ;transform the light vector
  32. dp3 r6.x,r7,-c12
  33. dp3 r6.y,r5,-c12
  34. dp3 r6.z,r8,-c12
  35.  
  36. ;bias around 128
  37. add r6.xyz,r6.xyz,c32
  38. mul oD0.xyz,r6.xyz,c33
  39.  
  40. ;transform into projection space
  41. m4x4 oPos,v0,c8
  42. mov oT0.xy,v7
  43. mov oT1.xy,v7
  44.  
  45.  
  46.  
  47.  
  48.  
  49.